package com.hfy.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hfy.model.po.admin.ApplyMusicPo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 就是作为一个中间表，没有实际的承担框架的作用，不然只使用一个表来承担数据的话 数据量要进行笛卡尔 Mapper 接口
 * </p>
 *
 * @author 韩
 * @since 2024-12-30
 */
@Mapper
public interface ApplyMusicMapper extends BaseMapper<ApplyMusicPo> {

    @Select("SELECT a.id id, apply_album_id applyAlbumId, name, music_url musicUrl, duration ," +
            " status, l.des des, ad.email adminEmail FROM `apply_music` a LEFT JOIN approval_log_music l ON a.id = l.apply_music_id" +
            " LEFT JOIN admin ad ON l.admin_id = ad.id WHERE a.id = #{id}")
    List<ApplyMusicPo> selectApplyMusicVoList(@Param("id") Integer id);
}